package com.qiaofang.applet.service.property.service.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;

/**
 * @author QF2019
 */
@Data
@ApiModel("二手房房源详情DTO,提供给后台管理系统使用")
public class SalePropertyListAdminDto extends PropertyDetailDto {

    @ApiModelProperty("id")
    private String id;

    @ApiModelProperty("售价")
    private BigDecimal sellPrice;

    @ApiModelProperty("售单价")
    private BigDecimal sellUnitPrice;

    @ApiModelProperty("房源状态 在售/已售")
    private String tradeStatusName;

    @ApiModelProperty("房源编号")
    private String propertyNo;

    @ApiModelProperty("归属员工1Uuid")
    private String employeeUuid1;

    @ApiModelProperty("归属员工1名称")
    private String employeeUuid1Name;

    @ApiModelProperty("归属人部门")
    private String deptName1;

    @ApiModelProperty("电话")
    private String mobilePhone;

    @ApiModelProperty("companyUuid")
    private String companyUuid;

    @ApiModelProperty("城市code")
    private String cityCode;

    @ApiModelProperty("城市名称")
    private String cityName;

    @ApiModelProperty(value = "是否主推", hidden = true)
    private Boolean recommend;

    @ApiModelProperty("是否主推,是/否")
    private String recommendStr;

    @ApiModelProperty(value = "上架/下架")
    private String upDownFlag;

    @ApiModelProperty(value = "首页主推排序")
    private Integer recommendSort;

    public String getTradeStatusName() {
        if (StringUtils.isNotBlank(getTradeStatus())) {
            if (getTradeStatus().equals("有效")) {
                tradeStatusName = "在售";
            } else if (getTradeStatus().equals("已售")) {
                tradeStatusName = "已售";
            } else {
                tradeStatusName = "暂无状态";
            }
        } else {
            tradeStatusName = "暂无状态";
        }
        return tradeStatusName;
    }

    public String getRecommendStr() {
        return recommend != null && recommend ? "是" : "否";
    }
}
